#include <REGX52.H>
#include "delay.h"
#include "MatrixLED.h"

unsigned char code Animation[]={
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0xFC,0x20,0x20,0x20,0xFC,0x00,0x18,0x24,
	0x24,0x1C,0x04,0x00,0x3F,0x24,0x24,0x3C,
	0x00,0x3F,0x24,0x24,0x3C,0x00,0x3D,0x05,
	0x05,0x3F,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};//收尾加了8个0x00,是为了画面有过度
//code 把数据存在flash（只读取，不写入）里，内存更大，若没写就会存在RAM里
//放在code的缺点：数组元素不能再更改了

void main()
{
	unsigned char i=0;
	unsigned char offset=0;//偏移量
	unsigned char count=0;
	MatrixLED_Init();
	while(1)
	{
		for(i=0;i<8;i++)
		{
			MatrixLED_ShowColumn(i,Animation[i+offset]);
		}
		count++;
		if(count>10)//相当于延时
		{
			count=0;//这句话不要忘了
			offset++;//按列显示
			//offset+=8;//显示逐帧动画
			if(offset>=40)//最好是>=
			{
				offset=0;//从头开始显示
			}
		}
	}
}